Many data storage systems are arrangements of hardware and software that include storage processors coupled to lists of non-volatile storage devices. In typical operation, storage processors service storage requests that arrive from client machines. The storage requests specify data objects (e.g., file systems, LUNs, vVols, and the like) to be accessed, overwritten, created, or deleted, for example. The storage processors run software that manages incoming storage requests and performs various data processing tasks to organize and secure the data stored on the non-volatile storage devices.
Storage systems are designed to guarantee data consistency stored on it. Data consistency means, given a set of storage requests, there exists a sequence, that the final data stored on disk can be determined by replaying the storage requests one after one in that sequence.
Frequently, storage requests originate with applications running on the client machines. Such applications typically launch multiple threads to write and read data from various locations on disk. However, some threads may try to write to certain addresses at the same time; such concurrent access may violate data consistency at those addresses on disk.
In order to guarantee such data consistency, some data storage systems provide range locks. A rangelock protects reads and writes which overlap in a range of data area. For example, when a thread is writing to a range, other threads requesting writes or reads to any byte in that range will be put to sleep until the lock is lifted; When a thread is reading from a range, other threads requesting writes to any byte in that range will be put to sleep until the lock is lifted while other threads requesting reads can still get served. This guarantees that data on disk is always in a consistent state under concurrent read and write requests.
Conventional approaches to implementing rangelock include implementations of non-greedy processes. In a non-greedy process, a thread is granted access to a range of data, when there are no other conflicting process waiting to access any byte of that area.